package com.scorpio.basic.service.impl;

import com.scorpio.basic.domain.HomeListResEntity;
import com.scorpio.basic.dto.HomeListResDTO;
import com.scorpio.basic.enums.HomeListRes1SiteEnum;
import com.scorpio.basic.mapper.HomeListResMapper;
import com.scorpio.basic.service.HomeListResService;
import com.scorpio.common.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class HomeListResServiceImpl extends BaseServiceImpl<HomeListResMapper, HomeListResEntity> implements HomeListResService {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public HomeListResDTO selectByHomeList(Long hId) {
        HomeListResDTO dto = new HomeListResDTO();
        dto.style1 = baseDao.selectByHId(hId, HomeListRes1SiteEnum.Top.getType());
        dto.style2 = baseDao.selectByHId(hId, HomeListRes1SiteEnum.BLeft.getType());
        dto.style3 = baseDao.selectByHId(hId, HomeListRes1SiteEnum.BRTop.getType());
        dto.style4 = baseDao.selectByHId(hId, HomeListRes1SiteEnum.BRBottom.getType());
        return dto;
    }
}
